---
comments: false
---

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/lottie-web/5.7.14/lottie.min.js"></script>
    <script src="jizi2_next.js"></script>
    <script src="leancloud.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/leancloud-storage/dist/av-min.js"></script>
    <style>
        #text-animate {
            font-size: 20px;
            margin-top: 50px;
            margin-bottom: 50px;
            text-align: center;
        }
        #lottie-container {
            width: 50px;
            height: 50px;
            align-content: center;
            transform: rotate(-90deg);
            background-color: black;
            border-radius: 50%;
        }
        #backButton {
            background-image: url('images/back.png');
            width: 20px;
            height: 20px;
            background-size: cover;
            cursor: pointer;
        }
        #buttonC {
            justify-content: center;
            align-items: center;
            display: flex;
            flex-wrap: nowrap;
            justify-content: space-between;
        }
        #saveButton {
            margin-left: 10px;
    padding: 0; /* 移除左右内边距 */
    height: 30px;
    width: 30px;
    align-items: center;
    background-color: #000;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    text-align: center;
    font-size: 13px;
    line-height: 30px; /* 设置行高与按钮高度相同 */
    }
    </style>
</head>
<body>
    <div id="buttonC">
        <div id="backButton"></div>
        <div id="saveButton">集</div>
    </div>
    <div id="text-animate">
        <h3 class="text-animate"></h3>
    </div>
    <div style="display: flex; justify-content: center;">
        <div id="lottie-container"></div>
    </div>
    <script>
        var dataArr = []
        hiddenEle();
        
        var postTitle = document.querySelector('.post-title');
    postTitle.style.display = 'none';
    var headeRight = document.querySelector('.header__right');
    headeRight.style.display = 'none';
    var headeLeft = document.querySelector('.header__left');
    headeLeft.style.display = 'none';
        var elements = document.querySelector('.post-title__text');
        elements.textContent = '今日写什么'
        var img = document.getElementById('backButton');
        img.addEventListener('click', function () {
            window.history.back()
        });
        var img2 = document.getElementById('saveButton');
        img2.addEventListener('click', function () {
            const inputText = document.getElementById("text-animate");
            const text = inputText.innerText;
            localStorage.setItem('jiziInputContent', text);
            window.location.href = 'jizi2_next.html';
        });

        var container = document.getElementById('lottie-container');
        var animation = lottie.loadAnimation({
            container: document.getElementById('lottie-container'), // 动画容器
            renderer: 'svg',
            loop: true,
            autoplay: true,
            path: 'images/Comp.json' // 你的 Lottie JSON 文件路径
        });

        animation.addEventListener('DOMLoaded', function() {
    var svg = container.querySelector('svg');
    svg.addEventListener('click', function(event) {
            index += 1
            if (index < dataArr.length) {
                setData()
            }else{
                random_requestFamousSentences(currentPage, pageSize, '', handleData)
            }
        });
});

        var currentPage = 1;
        var pageSize = 3; // 每页显示的条目数
        var index = 0;
        initLeanCloud()
        let arr = localStorage.getItem('famousSentencesArray');
            if (arr != null) {
                const i = localStorage.getItem('famousSentencesIndex') 
                index = Number(i);
                dataArr = JSON.parse(arr);
                setData()
            }else{
                random_requestFamousSentences(currentPage, pageSize, '', handleData)
            }
        function handleData(results) {
            index = 0
            dataArr = results
            setData()
        }
        function setData() {
            const obj = dataArr[index]
            console.log("obj:", JSON.stringify(obj, null, 2));
    
            // 遍历并打印对象的所有属性
            for (let key in obj) {
                console.log(key + ":", obj[key]);
            }

            // const text = obj["name"];
            const text = JSON.parse(JSON.stringify(obj)).name;
            const h = document.getElementById("text-animate");
            h.innerHTML = text;
        }
    </script>
</body>
</html>